import {AuthGuard} from '../auth/guard/auth.guard';
import {AdminLayoutComponent} from './layout/admin-layout.component';
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';

const routes: Routes = [
  {
    path: 'admin',
    component: AdminLayoutComponent,
    canActivate: [AuthGuard],
    canActivateChild: [AuthGuard],
    children: [
      {path: '', redirectTo: 'statistic', pathMatch: 'full'},
      {path: 'statistic', loadChildren: './statistic/statistic.module#StatisticModule', canActivate: [AuthGuard]},
      {path: 'userList', loadChildren: './user-list/user-list.module#UserListModule', canActivate: [AuthGuard]},
      {path: 'test', loadChildren: './test/test.module#TestModule', canActivate: [AuthGuard]},
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
  declarations: []
})
export class AdminRoutingModule {
}
